﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Cards
{
    class Player
    {
        private string _name;
        private IList<Card> _hand = new List<Card>();
        private readonly IList<CardCombos> _combos;

        public Player(string name)
        {
            _name = name;
        }

        public void addCardToHand(Card card)
        {
            _hand.Add(card);
        }

        public Boolean hasCard(CardRank rank)
        {
            return _hand.Any(c => c.Rank == rank);
        }

        public IEnumerable<Card> removeCardFromHand(CardRank rank)
        {
            var cards = _hand.TakeWhile(c => c.Rank == rank); 
            
            if (cards.Count() == 0)
            {
                //TODO what to do here
            }

            _hand = (IList<Card>)_hand.Except(cards);
            return cards;
        }
    }
}
